// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using System;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Runtime.Serialization;
using Elastic.Transport;

#nullable restore
namespace Elastic.Clients.Elasticsearch.License
{
	[JsonConverter(typeof(LicenseStatusConverter))]
	public enum LicenseStatus
	{
		[EnumMember(Value = "valid")]
		Valid,
		[EnumMember(Value = "invalid")]
		Invalid,
		[EnumMember(Value = "expired")]
		Expired,
		[EnumMember(Value = "active")]
		Active
	}

	internal sealed class LicenseStatusConverter : JsonConverter<LicenseStatus>
	{
		public override LicenseStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
		{
			var enumString = reader.GetString();
			switch (enumString)
			{
				case "valid":
					return LicenseStatus.Valid;
				case "invalid":
					return LicenseStatus.Invalid;
				case "expired":
					return LicenseStatus.Expired;
				case "active":
					return LicenseStatus.Active;
			}

			ThrowHelper.ThrowJsonException();
			return default;
		}

		public override void Write(Utf8JsonWriter writer, LicenseStatus value, JsonSerializerOptions options)
		{
			switch (value)
			{
				case LicenseStatus.Valid:
					writer.WriteStringValue("valid");
					return;
				case LicenseStatus.Invalid:
					writer.WriteStringValue("invalid");
					return;
				case LicenseStatus.Expired:
					writer.WriteStringValue("expired");
					return;
				case LicenseStatus.Active:
					writer.WriteStringValue("active");
					return;
			}

			writer.WriteNullValue();
		}
	}

	[JsonConverter(typeof(LicenseTypeConverter))]
	public enum LicenseType
	{
		[EnumMember(Value = "trial")]
		Trial,
		[EnumMember(Value = "standard")]
		Standard,
		[EnumMember(Value = "silver")]
		Silver,
		[EnumMember(Value = "platinum")]
		Platinum,
		[EnumMember(Value = "missing")]
		Missing,
		[EnumMember(Value = "gold")]
		Gold,
		[EnumMember(Value = "enterprise")]
		Enterprise,
		[EnumMember(Value = "dev")]
		Dev,
		[EnumMember(Value = "basic")]
		Basic
	}

	internal sealed class LicenseTypeConverter : JsonConverter<LicenseType>
	{
		public override LicenseType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
		{
			var enumString = reader.GetString();
			switch (enumString)
			{
				case "trial":
					return LicenseType.Trial;
				case "standard":
					return LicenseType.Standard;
				case "silver":
					return LicenseType.Silver;
				case "platinum":
					return LicenseType.Platinum;
				case "missing":
					return LicenseType.Missing;
				case "gold":
					return LicenseType.Gold;
				case "enterprise":
					return LicenseType.Enterprise;
				case "dev":
					return LicenseType.Dev;
				case "basic":
					return LicenseType.Basic;
			}

			ThrowHelper.ThrowJsonException();
			return default;
		}

		public override void Write(Utf8JsonWriter writer, LicenseType value, JsonSerializerOptions options)
		{
			switch (value)
			{
				case LicenseType.Trial:
					writer.WriteStringValue("trial");
					return;
				case LicenseType.Standard:
					writer.WriteStringValue("standard");
					return;
				case LicenseType.Silver:
					writer.WriteStringValue("silver");
					return;
				case LicenseType.Platinum:
					writer.WriteStringValue("platinum");
					return;
				case LicenseType.Missing:
					writer.WriteStringValue("missing");
					return;
				case LicenseType.Gold:
					writer.WriteStringValue("gold");
					return;
				case LicenseType.Enterprise:
					writer.WriteStringValue("enterprise");
					return;
				case LicenseType.Dev:
					writer.WriteStringValue("dev");
					return;
				case LicenseType.Basic:
					writer.WriteStringValue("basic");
					return;
			}

			writer.WriteNullValue();
		}
	}
}